//
//  AccountController.m
//  soccer
//
//  Created by 上官千城 on 15/9/10.
//  Copyright (c) 2015年 上官千城. All rights reserved.
//

#import "OAccountController.h"

@interface OAccountController ()

@end

@implementation OAccountController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"我的账号";
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT) style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
    
    
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    if (indexPath.row == 0 && indexPath.section == 0) {
        cell.textLabel.text = @"手机号码";
        UILabel *photoNum = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH - 120, 10, 110, 20)];
        photoNum.text = @"13940855135";
//        photoNum.backgroundColor = [UIColor orangeColor];
        [cell addSubview:photoNum];
    }
    if (indexPath.row == 1 && indexPath.section == 0) {
        cell.textLabel.text = @"邮箱绑定";
        UILabel *mail = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH - 200, 10, 190, 20)];
        mail.textAlignment = NSTextAlignmentRight;
        mail.text = @"chen4211@163.com";
        [cell addSubview:mail];
    }
    if (indexPath.row == 0 && indexPath.section == 1) {
        cell.textLabel.text = @"修改密码";
        //修改 行右侧按钮
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    return cell;
}
//设置区
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section== 0) {
        return 2;
    }
    return 1;
    
}
//点击触发方法
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{//手机
    if (indexPath.section == 0 && indexPath.row == 0) {
        OChangePasswordController *view = [[OChangePasswordController alloc]init];
        view.type = 1;
        [self.navigationController pushViewController:view animated:YES];
        
    }
    //改邮箱
    if (indexPath.section == 0 && indexPath.row == 1) {
        OChangePasswordController *view = [[OChangePasswordController alloc]init];
        view.type = 2;
        [self.navigationController pushViewController:view animated:YES];
    }
    //改密码
    if (indexPath.section == 1 && indexPath.row == 0) {
        OChangePasswordController *view = [[OChangePasswordController alloc]init];
        view.type = 4;
        [self.navigationController pushViewController:view animated:YES];
    }

}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
